What will this program write to the monitor?

A good answer might be:

New location:java.awt.Point[x=12,y=42]

Safe Conversions

In general, if there is the possibility that information will be LOST, a conversion between one type and another will NOT be performed automatically. A conversion from a data type that uses N bits to a type that uses fewer than N bits risks information loss, and will not be performed automatically. The compiler makes this decision by examining the data types involved, not the actual values involved.

In the following situations, the compiler will automatically convert from the type of the expression in a method call to the required type:

  1. Converting an integer type to another integer type that uses more bits.
  2. Converting a floating-point type to another floating point type that uses more bits.
  3. Converting an integer type to a floating point type that uses the same number of bits may result in a loss of precision, but will be done automatically.
  4. Converting an integer type to a floating point type with more bits will not result in loss of precision and will be done automatically.

"Loss of precision" means that some of the less significant digits may become zeros, but the most important digits and the size of the number will remain. For example 123456789 converted to 123456700.0 shows a loss of precision.

In the following situations, the compiler will not automatically perform the conversion.

Remember the sizes of the various primitive types (the primitive types char and boolean are not listed here):

typenumber of bits
byte8
short16
int32
long64
float32
double64

QUESTION 7:

Click the button in the appropriate column for the following type conversions. There is only one correct column per row.

conversion No information lost.

Automatic Conversion.
Possible loss of precision.

Automatic Conversion.
Possible great loss of information.

Requires a Type Cast.
byte to short
short to byte
short to long
int to float
float to byte
double to float